<?php 
include "db.php";
$conn=mysql_connect($dbip,$dbuser,$dbpass)or dir('連接服務器失敗:'. mysql_error());
if(mysql_select_db($dbname,$conn)){
echo "";
}else{echo ('連接資料庫失敗:'. mysql_error());}
mysql_query("set names utf-8");?>

<?php
//截取utf8字符串
function utf8substr($str, $from, $len)
{
    return preg_replace('#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.$from.'}'.
                       '((?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.$len.'}).*#s',
                       '$1',$str);
}
?>

<?php  if (isset($_GET[page]))
{
      $page=intval($_GET[page]);
}
else{
       
      $page=1;
}
?>

<?php function make_safe($variable) {
$variable = addslashes(trim($variable));
return $variable;
// $username = make_safe($_POST['username']);
}
?>

<?php
function unhtml($content)
 {
    $content=htmlspecialchars($content);
    $content=str_replace(chr(13),"<br>",$content);
    $content=str_replace(chr(32),"&nbsp;",$content);
   return trim($content);
 }
?>
